#include "animation.h"
#include "texture_manager.h"

using namespace alice;

void Animation::Update(double delta_time) {
  frame_ = (SDL_GetTicks() / frame_duration_) % frame_count_;
}

void Animation::Draw(int x, int y, int sprite_width, int sprite_height, SDL_RendererFlip flip) {
  TextureManager::GetInstance()->DrawFrame(texture_id_, x, y, sprite_width, sprite_height, sprite_row_, frame_, flip);
}

void Animation::SetProps(std::string texture_id, int sprite_row, int frame_count, int frame_duration) {
  texture_id_ = texture_id;
  sprite_row_ = sprite_row;
  frame_count_ = frame_count;
  frame_duration_ = frame_duration;
}